home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / pagede1a / imagemap.frm < prev    next >
Text File  |  1999-08-31  |  6KB  |  235 lines

  1. VERSION 5.00
  2. Begin VB.Form Form8 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "New image map"
  5.    ClientHeight    =   4605
  6.    ClientLeft      =   45
  7.    ClientTop       =   285
  8.    ClientWidth     =   5175
  9.    LinkTopic       =   "Form8"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   4605
  13.    ScaleWidth      =   5175
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.CommandButton Command1 
  17.       Caption         =   "Ok"
  18.       Default         =   -1  'True
  19.       Height          =   255
  20.       Left            =   4080
  21.       TabIndex        =   5
  22.       Top             =   0
  23.       Width           =   1095
  24.    End
  25.    Begin VB.TextBox Text1 
  26.       Height          =   285
  27.       Left            =   840
  28.       TabIndex        =   2
  29.       Top             =   360
  30.       Width           =   4215
  31.    End
  32.    Begin VB.CommandButton Command3 
  33.       Caption         =   "Add"
  34.       Height          =   255
  35.       Left            =   1320
  36.       TabIndex        =   1
  37.       Top             =   0
  38.       Visible         =   0   'False
  39.       Width           =   1095
  40.    End
  41.    Begin VB.CommandButton Command2 
  42.       Caption         =   "Browse image"
  43.       Height          =   255
  44.       Left            =   0
  45.       TabIndex        =   7
  46.       Top             =   0
  47.       Width           =   1335
  48.    End
  49.    Begin VB.VScrollBar VScroll1 
  50.       Height          =   3495
  51.       Left            =   4920
  52.       TabIndex        =   6
  53.       Top             =   840
  54.       Width           =   255
  55.    End
  56.    Begin VB.HScrollBar HScroll1 
  57.       Height          =   255
  58.       Left            =   0
  59.       TabIndex        =   3
  60.       Top             =   4320
  61.       Width           =   4935
  62.    End
  63.    Begin VB.PictureBox Picture1 
  64.       Height          =   3495
  65.       Left            =   0
  66.       ScaleHeight     =   229
  67.       ScaleMode       =   3  'Pixel
  68.       ScaleWidth      =   325
  69.       TabIndex        =   0
  70.       Top             =   840
  71.       Width           =   4935
  72.       Begin VB.PictureBox picview 
  73.          AutoSize        =   -1  'True
  74.          BackColor       =   &H00C0C0C0&
  75.          BorderStyle     =   0  'None
  76.          Height          =   375
  77.          Left            =   0
  78.          ScaleHeight     =   25
  79.          ScaleMode       =   3  'Pixel
  80.          ScaleWidth      =   33
  81.          TabIndex        =   4
  82.          Top             =   0
  83.          Width           =   495
  84.       End
  85.    End
  86.    Begin VB.Label Label1 
  87.       AutoSize        =   -1  'True
  88.       BackStyle       =   0  'Transparent
  89.       Caption         =   "Page url:"
  90.       Height          =   195
  91.       Left            =   120
  92.       TabIndex        =   8
  93.       Top             =   360
  94.       Width           =   630
  95.    End
  96. End
  97. Attribute VB_Name = "Form8"
  98. Attribute VB_GlobalNameSpace = False
  99. Attribute VB_Creatable = False
  100. Attribute VB_PredeclaredId = True
  101. Attribute VB_Exposed = False
  102. Dim start As Boolean
  103. Dim selectr As Boolean
  104. Dim x1 As Single
  105. Dim y1 As Single
  106. Dim x2 As Single
  107. Dim y2 As Single
  108. Dim filen As String
  109. Dim html As String
  110. Dim fcode As String
  111.  
  112. Private Sub Command1_Click()
  113. On Error Resume Next
  114. fcode = "<MAP NAME='map'>" & html & "<IMG SRC='" & filen & "' USEMAP='#map'></MAP>"
  115. Form6.Text1.SelText = fcode
  116. Unload Me
  117. End Sub
  118.  
  119. Private Sub Command2_Click()
  120. On Error GoTo er
  121. MDI.CommonDialog1.Filter = "Gif images(*.gif)|*.gif|Jpeg inmages(*.jpg)|*.jpg|Windows bitmap(*.bmp)|*.bmp|Windows Metafile(*.wmf)|*.wmf|Icons(*.ico)|*.ico|Cursers(*.cur)|*.cur|"
  122. MDI.CommonDialog1.ShowOpen
  123. picview.Picture = LoadPicture(MDI.CommonDialog1.filename)
  124.  
  125. filen = MDI.CommonDialog1.filename
  126. If picview.Width > Picture1.ScaleWidth Then
  127. HScroll1.Visible = True
  128. HScroll1.Max = picview.Width - Picture1.ScaleWidth
  129. Else
  130. HScroll1.Visible = False
  131. End If
  132. If picview.Height > Picture1.ScaleHeight Then
  133. VScroll1.Visible = True
  134. VScroll1.Max = picview.Height - Picture1.ScaleHeight
  135. Else
  136. VScroll1.Visible = False
  137. End If
  138.  
  139. Exit Sub
  140. er:
  141. If Err.Number <> 32755 Then
  142. MsgBox Err.Description
  143. End If
  144. End Sub
  145.  
  146. Private Sub Command3_Click()
  147.  
  148. On Error Resume Next
  149. If Text1.Text <> "" Then
  150. html = html + "<AREA SHAPE='RECT' COORDS='" & x1 & "," & y1 & "," & x2 & "," & y2 & "' HREF='" & Text1.Text & "'>"
  151. Command3.Visible = False
  152. Text1.Text = ""
  153. Else
  154. MsgBox "You must enter the page url"
  155. End If
  156. End Sub
  157.  
  158. Private Sub Form_Load()
  159.  
  160. start = True
  161. selectr = False
  162. On Error GoTo er
  163. MDI.CommonDialog1.Filter = "Gif images(*.gif)|*.gif|Jpeg inmages(*.jpg)|*.jpg|Windows bitmap(*.bmp)|*.bmp|Windows Metafile(*.wmf)|*.wmf|Icons(*.ico)|*.ico|Cursers(*.cur)|*.cur|"
  164. MDI.CommonDialog1.ShowOpen
  165. picview.Picture = LoadPicture(MDI.CommonDialog1.filename)
  166.  
  167. filen = MDI.CommonDialog1.filename
  168. If picview.Width > Picture1.ScaleWidth Then
  169. HScroll1.Visible = True
  170. HScroll1.Max = picview.Width - Picture1.ScaleWidth
  171. Else
  172. HScroll1.Visible = False
  173. End If
  174. If picview.Height > Picture1.ScaleHeight Then
  175. VScroll1.Visible = True
  176. VScroll1.Max = picview.Height - Picture1.ScaleHeight
  177. Else
  178. VScroll1.Visible = False
  179. End If
  180.  
  181. Exit Sub
  182. er:
  183. If Err.Number <> 32755 Then
  184. MsgBox Err.Description
  185. End If
  186. End Sub
  187.  
  188. Private Sub HScroll1_Change()
  189. HScroll1_Scroll
  190. End Sub
  191.  
  192. Private Sub HScroll1_Scroll()
  193. On Error Resume Next
  194. picview.Left = -HScroll1.Value
  195. End Sub
  196.  
  197. Private Sub picview_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  198. If start = True Then
  199. Command3.Visible = False
  200. x1 = X
  201. y1 = Y
  202. start = False
  203. selectr = True
  204. End If
  205.  
  206. End Sub
  207.  
  208. Private Sub picview_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  209. If selectr = True Then
  210. picview.Cls
  211. Rectangle picview.hdc, x1, y1, X, Y
  212. End If
  213. End Sub
  214.  
  215. Private Sub picview_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  216. If selectr = True Then
  217. Command3.Visible = True
  218. picview.Cls
  219. Rectangle picview.hdc, x1, y1, X, Y
  220. y2 = Y
  221. x2 = X
  222. start = True
  223. selectr = False
  224. End If
  225. End Sub
  226.  
  227. Private Sub VScroll1_Change()
  228. VScroll1_Scroll
  229. End Sub
  230.  
  231. Private Sub VScroll1_Scroll()
  232. On Error Resume Next
  233. picview.Top = -VScroll1.Value
  234. End Sub
  235.